package tp

import (
	"aifuture.cloud/hanlders"
	tpreq "aifuture.cloud/request/tp"
	"aifuture.cloud/services/tp"
	"github.com/gin-gonic/gin"
)

//实训项目处理器

type TpHandler struct {
}

func NewTpHandler() *TpHandler {
	return &TpHandler{}
}

func (t *TpHandler) List(c *gin.Context) {
	//查询实训项目信息
	tpSvc := tp.NewTpSvc(tp.NewTpMock())
	var tagReq tpreq.TpReq
	hanlders.HandlerError(c.ShouldBind(&tagReq), c)
	err, tpList := tpSvc.List(&tagReq)
	hanlders.HandlerError(err, c)
	hanlders.SuccessResponseHandler(c, tpList)
}
func (t *TpHandler) TagList(c *gin.Context) {
	//查询实训项目信息
	tpSvc := tp.NewTpSvc(tp.NewTpMock())
	err, tpList := tpSvc.TagList()
	hanlders.HandlerError(err, c)
	hanlders.SuccessResponseHandler(c, tpList)
}
type TpDetailReq struct {
	TpId int `query:"tp_id" binding:"required"`
}
func (t *TpHandler) Detail(c *gin.Context) {
	//课程查询器
	var courseDetailReq TpDetailReq
	err := c.ShouldBind(&courseDetailReq)
	hanlders.HandlerError(err, c)
	tpSvc := tp.NewTpSvc(tp.NewTpMock())
	err, tpList := tpSvc.Detail(courseDetailReq.TpId)
	hanlders.HandlerError(err, c)
	hanlders.SuccessResponseHandler(c, tpList)
}
